<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.farm.web.constant.FarmConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<style>
.guide-code {
	color: #090;
	font-size: 12px;
}

.guide-note {
	color: #800;
	font-size: 12px;
	margin-bottom: 10px;
}
</style>
<div>
	<h4>freemark模板规则</h4>
	<div
		style="background-color: #c8c9cc; border-radius: 4px; padding: 10px; margin: 10px;">
		<div class="guide-code">$ {emp.name?if_exists}</div>
		<div class="guide-note">变量存在，输出该变量，否则不输出</div>
		<div class="guide-code">$ {emp.name!}</div>

		<div class="guide-note">变量存在，输出该变量，否则不输出</div>

		<div class="guide-code">$ {emp.name?default("xxx")}</div>
		<div class="guide-note">变量不存在，取默认值xxx</div>

		<div class="guide-code">$ {emp.name!"xxx"}</div>
		<div class="guide-note">变量不存在，取默认值xxx</div>

		<hr>

		<div class="guide-code">$ {"123456"?html}</div>
		<div class="guide-note">对字符串进行HTML编码，对html中特殊字符进行转义</div>
		<div class="guide-code">$ {"str"?cap_first}</div>
		<div class="guide-note">首字母大写</div>
		<div class="guide-code">$ {"Str"?lower_case}</div>
		<div class="guide-note">换成小写</div>
		<div class="guide-code">$ {"Str"?upper_case}</div>
		<div class="guide-note">换成大写</div>
		<div class="guide-code">$ {"str"?trim}</div>
		<div class="guide-note">去掉前后空白</div>
		<div class="guide-code">$ {"str"?uncap_first}</div>
		<div class="guide-note">首字母小写</div>
		<div class="guide-code">capitalize</div>
		<div class="guide-note">所有单词首字母大写</div>
		<hr>
		<div class="guide-code">$ {.now}</div>
		<div class="guide-note">当前系统时间yyyy-MM-dd HH:mm:ss</div>

		<hr>
		<div class="guide-code">$ {'300.001'?number}</div>
		<div class="guide-note">字符串转数字结果为：300</div>
		<hr>
		<div class="guide-code">&lt;#if content?length gt
			100&gt;$ {t1}...&lt;#else&gt; $ {t2} &lt;/#if&gt;</div>
		<div class="guide-note">条件判断</div>
		<div class="guide-code">&lt;#list sequence as item&gt; item...
			&lt;/#list&gt;</div>
		<div class="guide-note">序列迭代</div>

	</div>
	<!-- <div class="guide-code"></div>
		<div class="guide-note"></div> -->
	<script type="text/javascript">
		$(function() {
				$('.guide-code').each(function(i,obj){
					$(obj).text($(obj).text().replace(' {', '{'));
				});
		});
	</script>
</div>